Skip to main content

ToolShedFacet

Functions

updatePool

the update pool function is called by the system as the first order of business on every deposit and withdraw and does the heavily lifting in terms of minting the SDEX block reward and distributing it out to the various pools.

Declaration

  function updatePool(
uint256 pid
) public onlyDiamond

Modifiers:

Modifier
onlyDiamond

Args:

ArgTypeDescription
piduint256the pool id currently being updated

updateStakingPool

Used during pool addtion, or allocPoint recalibration to manage total Allocation points for all pools

Declaration

  function updateStakingPool(
) public onlyDiamond

Modifiers:

Modifier
onlyDiamond

massUpdatePools

massUpdatePools can be called to update the state of all pools

Declaration

  function massUpdatePools(
) public

Modifiers:

No modifiers

getMultiplier

Normally Sdex is emitted at a constant rate per block, though sometimes a multiplier may be added to multiply this number a certain factor, getMultiplier manages this

Declaration

  function getMultiplier(
uint256 from,
uint256 to
) public returns (uint256)

Modifiers:

No modifiers

Args:

ArgTypeDescription
fromuint256the starting block one wishes to calculate from
touint256the final block one wishes to calculate from

Returns:

TypeDescription
uint256the multipler applied to all cake over this block period

totalAllocPoint

totalAllocPoint returns the total allocation points over all pools. This number is divided against to determine which proportion of the block emission goes to each pool

Declaration

  function totalAllocPoint(
) public returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
uint256total ammount of allocation points across all pools

sdexPerBlock

returns how many SDEX tokens are being emitted per block, remember to pair with the getMultiplier function if the bonus multiplier is not 1

Declaration

  function sdexPerBlock(
) public returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
uint256amount of SDEX emitted per block

tokenRewardData

tokenRewardData returns the inner tally of information that is kept on each token on the platform that concerns the distribution of rewards of each of these tokens from the penalty pool

Declaration

  function tokenRewardData(
address token
) public returns (struct TokenRewardData)

Modifiers:

No modifiers

Args:

ArgTypeDescription
tokenaddressaddress of token in question

Returns:

TypeDescription
TokenRewardDatasee {TokenRewardData} for more info

accSdexPenaltyPool

accumulated Sdex Penalty pool returns the amount of SDEX currently inside the special additionaly penalty pool for SDex that is accumulated by positions from block rewards that are withdrawn early

Declaration

  function accSdexPenaltyPool(
) public returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
uint256the amount in the the accumulated Sdex Penalty Pool

accSdexRewardPool

accumulated Sdex Reward pool returns the amount of SDEX currently allotted for Sdex rewards derived from the accumulated Sdex Penalty Pool.

Declaration

  function accSdexRewardPool(
) public returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
uint256the amount of Sdex placed aside for rewards

accSdexPaidOut

accumulated Sdex Paid Out returns the amount of SDEX that has been paid out from the rewards pool over all time.

Declaration

  function accSdexPaidOut(
) public returns (uint256)

Modifiers:

No modifiers

Returns:

TypeDescription
uint256the amount of Sdex paid out from NFT rewards

calcRefund

calcRefund returns the refund and penalty of an amount of a token given a startBlock (often the current Time) and the blockEnd (often the end of a stake) to determine how much is penalized and how much is refunded. Generally if one makes it through 50% of the take, one is refunded 50% of the tokens

Declaration

  function calcRefund(
uint256 startBlock,
uint256 blockEnd,
uint256 amount
) public returns (uint256 refund, uint256 penalty)

Modifiers:

No modifiers

Args:

ArgTypeDescription
startBlockuint256the block where this position started
blockEnduint256the block where this position is no longer penalized for withdrawing
amountuint256the amount of a token in question

Returns:

TypeDescription
refundhow much is refunded if withdrawing at start time given endTime and how much is penalized
penaltyhow much one is penalized